package itsm.isperp.framework.web.servlet.handler;

import itsm.isperp.framework.core.context.ContextHolder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * 
 * 
 * 
 * @author lizx
 * @date 2014-7-12
 * @since 1.0
 * 
 */
public class PagePopulationInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		if (modelAndView != null) {
			modelAndView.addObject("contextUrl",
					ContextHolder.getWebServerName(request));
			modelAndView.addObject("contextPath", request.getContextPath());
		}

	}
}